<?php
// 本类由系统自动生成，仅供测试用途
class BaseAction extends Action{

	public $webInfo;
    function _initialize() {
		$dao = D("WebInfo");

		$this->webInfo = $dao->find();

		$this->assign('webInfo',$this->webInfo);


		//输出模板变量
		$dao = D('TplVar');
		$var_list = $dao->select();

		$cnt = count($var_list);
		$var_prefix = C('TPLVAR_PREFIX');
		for($i=0;$i<$cnt;$i++)
		{
			$vname = $var_prefix.$var_list[$i]['name'];

        	$this->assign($vname,$var_list[$i]['content'] );
		}
    }
	
	public function error($msg)
    {
    	header("Content-type: text/html; charset=utf-8");
    	echo '<script language="javascript">alert("'.$msg.'");history.back();</script>'; //返回
		exit ();
 
    }
    
    public function success($msg,$url)
    {
    	header("Content-type: text/html; charset=utf-8"); 
    	if( !empty($url))
    		echo '<script language="javascript">alert("'.$msg.'");location.href="' . $url . '";</script>';
    	else
    		echo '<script language="javascript">alert("'.$msg.'");history.back();</script>'; //返回
    	exit();
    }
}
?>